package com.fa4j.common.base.exception;

/**
 * 错误类型接口
 */
public interface BusinessErrorType extends ErrorType {

    /**
     * 构建异常
     */
    default BusinessException build(Object... args) {
        return build(null, null, null, args);
    }

    /**
     * 构建异常
     */
    default BusinessException build(String message) {
        return build(null, message, null);
    }

    /**
     * 构建异常
     */
    default BusinessException build(Object errData) {
        return build(errData, null, null, (Object) null);
    }

    /**
     * 构建异常
     */
    default BusinessException build(Object errData, String message, Throwable cause, Object... args) {
        return new BusinessException(this, message, args, cause, errData);
    }

}
